#property  copyright " yuriy  tokman "

#property  link      "yuriytokman@gmail.com"


#property  indicator_chart_window

//---- input  parameters

extern  int       barsToProcess=1000;


// +------------------------------------------------------------------+

//| Custom  indicator  initialization  function                         |

// +------------------------------------------------------------------+

int  init ()

  {

//---- indicators

//----

   return (0);

  }

// +------------------------------------------------------------------+

//| Custom  indicator  deinitialization  function                       |

// +------------------------------------------------------------------+

int  deinit ()

  {

//----

int i;

  
  for (i=0; i<  Bars; i++)

    {

    ObjectDelete ("hung or hammer "+DoubleToStr (i, 0));

    ObjectDelete ("bull absorption " +DoubleToStr (i, 0));

    ObjectDelete ("bear absorption " +DoubleToStr (i, 0));

    ObjectDelete ("curtain from the dark clouds " +DoubleToStr (i, 0));

    ObjectDelete ("the cloud gap " +DoubleToStr (i, 0));

    ObjectDelete ("doji " +DoubleToStr (i, 0));

    }

//----

   return (0);

  }

// +------------------------------------------------------------------+

//| Custom  indicator  iteration  function                              |

// +------------------------------------------------------------------+

int  start ()

  {

   int    counted_bars=IndicatorCounted (),

//----

   limit,

   i=0; 

   if (counted_bars> 0)

      counted_bars--;

   

   limit=Bars-counted_bars;

   

   if (limit>  barsToProcess)

      limit=barsToProcess;


   while (i<  limit)

   {           

                                 // hung or the hammer

      double k = (High [i] - Low [i]) /3;

      if ((Open [i]> (Low [i]  +2*k))&& (Close [i]> (Low [i]  +2*k)))

       {

        ObjectCreate ("hung or hammer "+DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], High [i]  +10*Point);

        ObjectSet ("hung or hammer "+DoubleToStr (i, 0), OBJPROP_ARROWCODE, 108);

        ObjectSet ("hung or hammer "+DoubleToStr (i, 0), OBJPROP_COLOR, DimGray);

       }            

                                // the bull absorption

      if ((Open [ i+1]>  Close [ i+1]) && (Close [ i+1]>  Open [i]) && (Close [i]>  Open [ i+1]))

       {

        ObjectCreate ("bull absorption " +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], Low [i] - 15*Point);

        ObjectSet ("bull absorption " +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 110);

       }            

                               // the bear absorption

       if ((Close [ i+1]>  Open [ i+1]) && (Open [i]>  Close [ i+1]) && (Open [ i+1]>  Close [i]))

       {

        ObjectCreate ("bear absorption " +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], High [i]  +15*Point);

        ObjectSet ("bear absorption " +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 110);

        ObjectSet ("bear absorption " +DoubleToStr (i, 0), OBJPROP_COLOR, Lime);

       }

                               // curtain from the dark clouds

       if ((Open [ i+1]<  Close [ i+1]) && (Open [i]>  High [ i+1]) && (Close [i]< (Open [ i+1] + (Close [ i+1] - Open [ i+1]) /2)))

       {

        ObjectCreate ("curtain from the dark clouds " +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], High [i]  +25*Point);

        ObjectSet ("curtain from the dark clouds " +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 116);

        ObjectSet ("curtain from the dark clouds " +DoubleToStr (i, 0), OBJPROP_COLOR, Lime);

       }

                               // cloud gap 

       if ((Open [ i+1]>  Close [ i+1]) && (Low [ i+1]>  Open [i]) && (Close [i]> (Close [ i+1] + (Open [ i+1] - Close [ i+1]) /2)))

       {

        ObjectCreate ("the cloud gap " +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], Low [i] - 25*Point);

        ObjectSet ("the cloud gap " +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 116);

       }

                               // doji

       if (Open [i]  ==Close [i])

       {

        ObjectCreate ("doji " +DoubleToStr (i, 0), OBJ_ARROW, 0, Time [i], High [i]  +30*Point);

        ObjectSet ("doji " +DoubleToStr (i, 0), OBJPROP_ARROWCODE, 174);

        ObjectSet ("doji " +DoubleToStr (i, 0), OBJPROP_COLOR, Indigo);

       }

     i++;  

   }


//----

   return (0);

  }